﻿@using DTcms.Model;
@using DTcms.Common;
@{
   DTcms.Model.channel_site site = ViewData["site"] as DTcms.Model.channel_site;
   DTcms.Model.siteconfig config = ViewData["config"] as DTcms.Model.siteconfig;
   DTcms.Web.MVC.UI.Controllers.BaseController bc = ViewBag.BasePage as DTcms.Web.MVC.UI.Controllers.BaseController;
}
   <script>
      function search() {
         var url = "@bc.linkurl("search")";
         SiteSearch(url, "#keywords");
      }
   </script>
<div class="header">
  <div class="header-wrap">
    <div class="section">
      <div class="left-box">
        <a class="logo" href="@bc.linkurl("index")">@site.name</a>
        <p class="nav">
          <a href="@bc.linkurl("news")">资讯</a>
          <a href="@bc.linkurl("goods")">商城</a>
          <a href="@bc.linkurl("video")">视频</a>
          <a href="@bc.linkurl("photo")">图片</a>
          <a href="@bc.linkurl("down")">下载</a>&nbsp;&nbsp;&nbsp;&nbsp;
         <a href="@bc.linkurl("index")?site=shop">商城版演示</a>
         <a href="@bc.linkurl("index")?site=cms">平台介绍</a>
        </p>
      </div>
      <div class="search">
        <input id="keywords" name="keywords" class="input" type="text" onkeydown="if(event.keyCode==13){search();return false};" placeholder="输入回车搜索" x-webkit-speech="" />
        <input class="submit" type="submit" onclick="search();" value="搜索" />
      </div>
      <div class="right-box">
      <script type="text/javascript">
         $.ajax({
            type: "POST",
            url: "@(config.webpath)tools/submit_ajax.ashx?action=user_check_login",
            dataType: "json",
            timeout: 20000,
            success: function (data, textStatus) {
               if (data.status == 1) {
                  $("#menu").prepend('<li class="line"><a href="@bc.linkurl("usercenter","exit")">退出</a></li>');
                  $("#menu").prepend('<li class="login"><em></em><a href="@bc.linkurl("usercenter","index")">会员中心</a></li>');
               } else {
                  $("#menu").prepend('<li class="line"><a href="@bc.linkurl("register")">注册</a></li>');
                  $("#menu").prepend('<li class="login"><em></em><a href="@bc.linkurl("login")">登录</a></li>');
               }
            }
         });
		</script>
        <ul id="menu">
          <li>
            <a href="@bc.linkurl("cart")">购物车<span id="shoppingCartCount"><script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_cart_count"></script></span>件</a>
          </li>
          <li><a href="@bc.linkurl("content","contact")">联系我们</a></li>
        </ul>
      </div>
    </div>
  </div>
</div>